const lazy = require('./lazy')
const config = require('./config.json')
const mongojs = require('mongojs')

module.exports = lazy(() => {
    console.log('Mongodb was connected! This info should occur only once')
    const db = config.db
    const connect_str = `${db.user}:${db.pass}@${db.ip}/${db.db}?authSource=${db.auth_db}`
    // console.log(connect_str)
    return mongojs(connect_str, db.collections)
})